#ifndef __THREADPOOL_H__
#define __THREADPOOL_H__

#include "TaskQueue.h"

#include <thread>
#include <vector>

using std::vector;
using std::thread;


class ThreadPool
{
public:
    ThreadPool(int threadNumber,int taskqueueCapa);
    ~ThreadPool();
    void start();
    void stop();
    void addTask(ElemType ptask);
private:
    ElemType getTask();
    void dotask();

private:
    int _threadNumber;
    vector<thread> _threads;
    int _taskqueueCapa;
    TaskQueue _taskque;
    bool isExit;

};

#endif

